<template>
  <a-form :model="sysSetting" style="width: 50%" @submit-success="handleSubmit">
    <a-form-item field="clientVideoPort" :rules="[{validator:port}]" :validate-trigger="['change','input']"  tooltip="视频服务端口号" label="视频服务端口号">
      <a-input
          v-model="sysSetting.clientVideoPort"
          placeholder="视频服务端口号"
      />
    </a-form-item>
    <a-form-item>
      <a-button html-type="submit">提交</a-button>
    </a-form-item>
  </a-form>
</template>
<script>
import {get, post} from "@/js/axios_util";
import {Message} from "@arco-design/web-vue";
import {updateSettings} from "@/js/sysSettings";
import {port} from "@/js/validator";

export default {
  name: "pc_settings",
  data() {
    return {
      sysSetting: {}
    }
  }, created() {
    get('/sys_settings/get', (response) => {
          this.sysSetting = response.data.result;

        }
    )
  }, methods: {
    port,
    handleSubmit() {
      post('/sys_settings/update', this.sysSetting, (response) => {
            if (response.data.success) {
              updateSettings(this.sysSetting);
              Message.info({content: "操作成功", showIcon: true});
            }
          }
      )
    }
  }
}
</script>